package com.afu.demo;
import java.util.*;
import java.util.concurrent.ConcurrentHashMap;

/**
 * 
 */
public class MapDemo1 {

    public static void main(String[] args) {
        System.out.println("input          1 : 1     3 : 3     2 : 2     4 : 4     5 : 5");
        //HashMap
        Map<String, String> hashMap = new HashMap<String, String>();
        hashMap.put("1", "1");
        hashMap.put("3", "3");
        hashMap.put("2", "2");
        hashMap.put("4", "4");
        hashMap.put("5", "5");
        System.out.print("HashMap        ");
        for (String key : hashMap.keySet()) {
            System.out.print(key + " : " + hashMap.get(key) + "     ");
        }
        System.out.println();
        
        //LinkedHashMap
        Map<String, String> linkedHashMap = new LinkedHashMap<String, String>();
        linkedHashMap.put("1", "1");
        linkedHashMap.put("3", "3");
        linkedHashMap.put("2", "2");
        linkedHashMap.put("4", "4");
        linkedHashMap.put("5", "5");
        System.out.print("LinkedHashMap  ");
        for (String key : linkedHashMap.keySet()) {
            System.out.print(key + " : " + linkedHashMap.get(key) + "     ");
        }
        System.out.println();


        //TreeMap
        Map<String, String> treeMap = new TreeMap<String, String>();
        treeMap.put("1", "1");
        treeMap.put("3", "3");
        treeMap.put("2", "2");
        treeMap.put("4", "4");
        treeMap.put("5", "5");
        System.out.print("TreeMap        ");
        for (String key : treeMap.keySet()) {
            System.out.print(key + " : " + treeMap.get(key) + "     ");
        }
        System.out.println();

    }
}